"""
MinMaxScaler、Normalize、StandardScaler
"""
from sklearn.preprocessing import MinMaxScaler,normalize,StandardScaler
def minmax_scaler_demo():
    data = [[90, 170], [60, 160], [30, 150]]  # [成绩, 身高]
    transfer = MinMaxScaler()
    data_scaled = transfer.fit_transform(data)
    print(data_scaled)
    return None

def normalize_demo():
    data = [[3, 4], [1, 1]]  # 两个学生的两科排名
    data_scaled = normalize(data, norm='l2', axis=1)  # 不用创建转换器对象，直接调用normalize方法
    print(data_scaled)
    return None

def standard_scaler_demo():
    data = [[100, 10], [200, 20], [300, 30]]  # [人口百万, GDP万亿]
    scaler = StandardScaler()
    scaled = scaler.fit_transform(data)
    print(scaled)
    return None




if __name__ == '__main__':
    # MinMax 归一化
    minmax_scaler_demo()
    # Normalize 归一化
    normalize_demo()
    # StandardScaler 标准化
    standard_scaler_demo()
